package com.moyoutian.daogenerate.controller;

import com.moyoutian.daogenerate.entity.TableEntity;
import com.moyoutian.daogenerate.entity.TableId;
import com.moyoutian.daogenerate.service.TableService;
import lombok.AllArgsConstructor;
import org.springframework.data.domain.Page;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

@Controller
@AllArgsConstructor
@RequestMapping("table")
public class TableController {

    private final TableService tableService;


    @GetMapping("/list")
    @ResponseBody
    public Page<TableEntity> findAll(TableEntity tableEntity) {
        return tableService.findAll(tableEntity);
    }

    @GetMapping("/getOne")
    @ResponseBody
    public TableEntity getOen(TableId tableId) {
        return tableService.getOne(tableId);
    }



}
